//
//  WorkerView.m
//  ZYShang
//
//  Created by wangguangming on 15/8/3.
//  Copyright © 2015年 Amber. All rights reserved.
//

#import "WorkerView.h"
#import "Base.h"
#define WIDTH self.frame.size.width
@implementation WorkerView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
        {
        self.backgroundColor=COLOR;
        [self addall];
        }
    return self;
}
-(void)addall
{
    
    self.oidLaber=[[UILabel alloc] initWithFrame:CGRectMake(5, 0, WIDTH/3, 40)];
    
    self.logoButton=[[UIButton alloc] initWithFrame:CGRectMake(WIDTH-40, 0, 40, 40)];
        //self.logoButton.backgroundColor=[UIColor redColor];
    UILabel *l=[[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.oidLaber.frame)+1, WIDTH, 1)];
    l.backgroundColor=COLOR;
    
    self.photoImage=[[UIImageView alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(l.frame)+3, WIDTH/4, WIDTH/4)];
    
    self.roleLaber=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.photoImage.frame)+2, CGRectGetMinY(self.photoImage.frame), WIDTH*3/4, WIDTH/12)];
    [self.roleLaber setAdjustsFontSizeToFitWidth:YES];
    
    self.nameLaber=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.photoImage.frame), CGRectGetMaxY(self.roleLaber.frame), WIDTH/4, WIDTH/12)];
    
    self.typeLaber=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.nameLaber.frame)+3, CGRectGetMinY(self.nameLaber.frame), WIDTH/5, WIDTH/12)];
    self.typeLaber.layer.borderColor=[[UIColor redColor] CGColor];
    self.typeLaber.layer.cornerRadius=4;
    self.typeLaber.layer.borderWidth=1;
    self.typeLaber.textColor=[UIColor redColor];
    
     self.offLaber=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.typeLaber.frame)+10, CGRectGetMinY(self.typeLaber.frame), WIDTH/5, WIDTH/12)];
    self.offLaber.layer.borderColor=[[UIColor redColor] CGColor];
     self.offLaber.layer.cornerRadius=4;
    self.offLaber.layer.borderWidth=1;
    self.offLaber.textColor=[UIColor redColor];
    self.typeLaber.textAlignment=NSTextAlignmentCenter;
    self.offLaber.textAlignment=NSTextAlignmentCenter;

    
    self.phoneLaber=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.photoImage.frame), CGRectGetMaxY(self.nameLaber.frame), WIDTH*3/4, WIDTH/12)];
    
    UILabel *ll=[[UILabel alloc] initWithFrame:CGRectMake(0,CGRectGetMaxY(self.photoImage.frame)+3, WIDTH, 5)];
    ll.backgroundColor=COLOR;
    self.oidLaber.textColor=[UIColor grayColor];
    self.phoneLaber.textColor=[UIColor grayColor];
    self.nameLaber.textColor=[UIColor grayColor];
   
    self.roleLaber.textColor=BLUECOLOL;
    
    
    [self addSubview:ll];
    [self addSubview:self.oidLaber];
    [self addSubview:l];
    [self addSubview:self.logoButton];
    [self addSubview:self.phoneLaber];
    [self addSubview:self.photoImage];
    [self addSubview:self.nameLaber];
    [self addSubview:self.typeLaber];
    [self addSubview:self.offLaber];
    [self addSubview:self.roleLaber];
    
    
    
}
@end
